<template>
  <div>
    <header-tilte :title="title"></header-tilte>
    <div class="body">
      <img id="qrcode" src="./img/person_refer_default.jpg" v-if="url == undefined || url == null || url == ''">
      <img :src="url" v-lazy="url" v-if="url != '' && url !='' && url != '' ">
    </div>
  </div>
</template>

<script>
    import HeaderTilte from "../../components/headerTilte";

    export default {
      data(){
        return{
          title:'邀好友微信订水',
          mid:'',
          url:''
        }
      },
      components: {HeaderTilte},
      name: "refer-person",
      mounted(){
        this.mid = this.$route.query.mid;
        if(this.isEmpty(this.mid)){
          history.go(-1)
          return
        }else {
          this.initQrcode();
        }
      },
      methods:{
        initQrcode(){
          this.yesS.commissionQr(
            {mid:this.mid}
          ).then(res => {
            this.url =  res.data.qr;
            var shop_name = res.data.shop_name;
           /* this.title = shop_name;*/
            this.$toast.success('二维码有效期30天')
          })
        }
      },
    }
</script>

<style scoped>
  /*@import 'http://cdn.bootcss.com/material-design-icons/3.0.1/iconfont/material-icons.css';*/
  .body{
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    bottom: 0;
  }

  .body img{
    width: 100%;
    height: 100%;
  }
</style>
